﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using AesonIntegrationTestLibrary.DataModel;
using AesonIntegrationTestLibrary.PubSubEvents;
using AesonIntegrationTestLibrary.TestAttributes;
using Microsoft.Practices.Prism.PubSubEvents;

namespace AesonIntegrationTestLibrary.Factory
{
    public static class TestFactory<T> where T : class
    {
        public static async void RunTest(IEventAggregator ea, int TestNumber = 1)
        {
            //var inst = Activator.CreateInstance(typeof(T));
            //DateTime startDate = DateTime.Now;
            //AesonTestFlow t = AesonTestFlow.Create(ea, TestNumber);

            //var initMethose = inst.GetType().GetMethods().Where(p => Attribute.IsDefined(p, typeof(InitDataModel)));
            //Parallel.ForEach(initMethose, m =>
            //    Task.Factory.StartNew(() =>
            //          t.AddResult((AesonTest)m.Invoke(inst, null))));


            //var methodeToTest = inst.GetType().GetMethods().Where(p => Attribute.IsDefined(p, typeof(ToTest)));
            //Parallel.ForEach(methodeToTest, m =>
            //    Task.Factory.StartNew(() =>
            //          t.AddResult((AesonTest)m.Invoke(inst, null))));

            //t.EndTest();
        }
    }

}
